<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>
    <h3 @click="goArt">带参数的跳转</h3>
    <router-link to="/home">home</router-link>
    <router-link to="/articles">article</router-link>
    <router-link to="/images">images</router-link>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      msg: "Welcome to Your Vue.js App"
    };
  },
  mounted() {
    console.log(this);

    this.$http
      .post("https://www.zhanggongze.com/api/article/list", {})
      .then(function(response) {
        console.log(response.body);
      })
      .catch(function(error) {
        console.log(error);
      });
  },
  methods: {
    goArt() {
      this.$router.push({ name: "articles", params: { name: "zgz", age: 12 } });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang = "scss">
h1,
h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
